Xchanginghas agreed to buy Indian rival Cambridge Solutions in a deal it hopes will transform it into one of the world's largest business process outsourcers to the private sector.